//package com.hoangkien.activity;
//
//import java.util.ArrayList;
//
//import android.annotation.SuppressLint;
//import android.app.Activity;
//import android.app.Fragment;
//import android.app.FragmentManager;
//import android.graphics.Color;
//import android.os.Bundle;
//import android.view.View;
//import android.widget.AdapterView;
//import android.widget.AdapterView.OnItemSelectedListener;
//import android.widget.ArrayAdapter;
//import android.widget.ListView;
//
//import com.hoangkien.adapter.CategoryAdapter;
//import com.hoangkien.entity.CategoryEntity;
//import com.hoangkien.fragment.FragmentCategoryImg;
//import com.hoangkien.service.CategoryService;
//import com.mango.hoangkien.coloringkids.R;
//import com.ptr.folding.FoldingPaneLayout;
//
//public class ImageByCategoryActivity extends Activity {
//	private FoldingPaneLayout mPaneLayout;
//	private ListView mPaneList;
//	private CharSequence mTitle;
//	CategoryService catService; 
//	ArrayList<CategoryEntity> lisCategoryEntity;
//	private ItemSelectedListener mItemSelectedListener;
//
//	@Override
//	protected void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//		setContentView(R.layout.category_img);
//		mPaneLayout = (FoldingPaneLayout) findViewById(R.id.drawer_layout);
//		mPaneList = (ListView) findViewById(R.id.left_drawer);
//		mItemSelectedListener = new ItemSelectedListener();
//		mPaneLayout.getFoldingLayout().setBackgroundColor(Color.BLACK);
//		catService = new CategoryService(ImageByCategoryActivity.this);
//		lisCategoryEntity = catService.getAllCategory();
//		String[] arrNameCateStrings = new String[lisCategoryEntity.size()];
//		for (int i = 0; i < arrNameCateStrings.length; i++) {
//			arrNameCateStrings[i] = lisCategoryEntity.get(i).getName();
//		}
//		CategoryAdapter categoryAdapter = new CategoryAdapter(this, R.id.text1, arrNameCateStrings);
//		mPaneList.setAdapter(categoryAdapter);
//		mPaneList.setOnItemClickListener(new DrawerItemClickListener());
//
//		if (savedInstanceState == null) {
//			selectItem(0);
//		}
//	}
//	
//	private class DrawerItemClickListener implements ListView.OnItemClickListener {
//		@Override
//		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//			if (mPaneLayout.isOpen()) {
//				selectItem(position);
//			}
//		}
//	}
//
//	private class ItemSelectedListener implements OnItemSelectedListener {
//		@Override
//		public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
//			int mNumberOfFolds = Integer.parseInt(parent.getItemAtPosition(pos).toString());
//			mPaneLayout.getFoldingLayout().setNumberOfFolds(mNumberOfFolds);
//		}
//
//		@Override
//		public void onNothingSelected(AdapterView<?> arg0) {}
//	}
//	
//	@SuppressLint("NewApi") 
//	private void selectItem(int position) {
//		FragmentCategoryImg fragment = new FragmentCategoryImg();
//		Bundle args = new Bundle();
////		args.putInt(AnimalFragment.ARG_ANIMAL_NUMBER, position);
//		fragment.setArguments(args);
//
//		FragmentManager fragmentManager = getFragmentManager();
//		fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
//
//		mPaneList.setItemChecked(position, true);
////		setTitle(mAnimalTitles[position]);
//		mPaneLayout.closePane();
//	}
//}
